<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
var myImage = (function () {
    var imgNode = document.createElement('img');
    document.body.appendChild(imgNode);
    return {
        setSrc:function (src) {
            imgNode.src=src;
        }
    }
})();
myImage.setSrc('http://www.baobeihuijia.com/images/banner-01.jpg')
</script>
</body>
</html>